﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminSite.Master" AutoEventWireup="true" CodeBehind="quanlytinraovat.aspx.cs" Inherits="WebRaoVat.Admin.QuanLyTinRaoVat" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
		 <div id="blockright">
		 <div id="box-pro-highlights-main">
		<div class="content">
        	<div class="box-pro-highlights-main-header">
			    [Tin rao vặt] Quản lý tin rao vặt
            </div>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" 
                AutoGenerateColumns="False" DataKeyNames="MaTinRaoVat"
                DataSourceID="SqlDataSource2" onrowupdating="GridView1_RowUpdating">
                <Columns>
                    <asp:CommandField ShowEditButton="True" CancelText="Hủy" UpdateText="Cập nhật" EditText="Sửa" />
                    <asp:TemplateField HeaderText="MaTinRaoVat" InsertVisible="False" 
                        SortExpression="MaTinRaoVat">
                        <EditItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaTinRaoVat") %>'></asp:Label>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Mã tin
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("MaTinRaoVat") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Deleted" SortExpression="Deleted">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList9" runat="server" DataValueField="Deleted"
                            SelectedValue='<% # Bind("Deleted") %>'>
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Đã xóa
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList10" runat="server" DataValueField="Deleted"
                            SelectedValue='<% # Bind("Deleted") %>' Enabled="false">
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenTinRaoVat" SortExpression="TenTinRaoVat">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server"  Width="120px" Text='<%# Bind("TenTinRaoVat") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Tên tin
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("TenTinRaoVat") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thumbnail" SortExpression="Thumbnail">
                        <EditItemTemplate>
                            <asp:Image ID="Image1" runat="server" 
                                ImageUrl='<%# Eval("Thumbnail", "~/{0}") %>'/>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Thumbnail
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Image ID="Image2" runat="server" 
                                ImageUrl='<%# Eval("Thumbnail", "~/{0}") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="GiaTien" SortExpression="GiaTien">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Width="45px" Text='<%# Bind("GiaTien") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Giá tiền
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("GiaTien") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianDang" SortExpression="ThoiGianDang">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" Width="90px" Text='<%# Bind("ThoiGianDang") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Thời gian đăng
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="SoLanXem" SortExpression="SoLanXem">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox4" runat="server"  Width="40px"  Text='<%# Bind("SoLanXem") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Lần xem
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("SoLanXem") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="MaNguoiDung" SortExpression="MaNguoiDung">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList8" runat="server" 
                                DataSourceID="SqlDataSource4" DataTextField="MaNguoiDung" 
                                DataValueField="MaNguoiDung" SelectedValue='<% # Bind("MaNguoiDung") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [MaNguoiDung] FROM [NGUOIDUNG]"></asp:SqlDataSource>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Mã người dùng
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList7" runat="server" Enabled="false"
                                DataSourceID="SqlDataSource4" DataTextField="MaNguoiDung" 
                                DataValueField="MaNguoiDung" SelectedValue='<% # Bind("MaNguoiDung") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [MaNguoiDung] FROM [NGUOIDUNG]"></asp:SqlDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenNgonNgu" SortExpression="TenNgonNgu">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList5" runat="server" Width="70px"
                                DataSourceID="SqlDataSource3" DataTextField="TenNgonNgu" 
                                DataValueField="TenNgonNgu" SelectedValue='<% # Bind("TenNgonNgu") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenNgonNgu] FROM [NGONNGU]"></asp:SqlDataSource>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Ngôn ngữ
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList6" runat="server" Enabled="false"  Width="70px" 
                                DataSourceID="SqlDataSource3" DataTextField="TenNgonNgu" 
                                DataValueField="TenNgonNgu" SelectedValue='<% # Bind("TenNgonNgu") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenNgonNgu] FROM [NGONNGU]"></asp:SqlDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenDanhMucCon" SortExpression="TenDanhMucCon">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList4" runat="server" Width="90px" 
                                DataSourceID="SqlDataSource2" DataTextField="TenDanhMucCon" 
                                DataValueField="TenDanhMucCon" SelectedValue='<% # Bind("TenDanhMucCon") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenDanhMucCon] FROM [DANHMUCCON]">
                            </asp:SqlDataSource>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Tên danh mục con
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList3" runat="server" Enabled="false" 
                                DataSourceID="SqlDataSource2" DataTextField="TenDanhMucCon"  Width="90px" 
                                DataValueField="TenDanhMucCon" SelectedValue='<% # Bind("TenDanhMucCon") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenDanhMucCon] FROM [DANHMUCCON]">
                            </asp:SqlDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenDiaDiem" SortExpression="TenDiaDiem">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" 
                                DataSourceID="SqlDataSource1" DataTextField="TenDiaDiem"  Width="90px" 
                                DataValueField="TenDiaDiem" SelectedValue='<% # Bind("TenDiaDiem") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenDiaDiem] FROM [DIADIEM]"></asp:SqlDataSource>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Tên địa điểm
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server" Enabled="false" Width="90px" 
                                DataSourceID="SqlDataSource1" DataTextField="TenDiaDiem" 
                                DataValueField="TenDiaDiem"  SelectedValue='<% # Bind("TenDiaDiem") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenDiaDiem] FROM [DIADIEM]"></asp:SqlDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                </Columns>
            </asp:GridView>
		    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                ProviderName="System.Data.SqlClient" 
                
                SelectCommand="SELECT TINRAOVAT.MaTinRaoVat, TINRAOVAT.Deleted, TINRAOVAT.TenTinRaoVat, TINRAOVAT.Thumbnail, TINRAOVAT.GiaTien, TINRAOVAT.ThoiGianDang, TINRAOVAT.SoLanXem, TINRAOVAT.MaNguoiDung, NGONNGU.TenNgonNgu, DANHMUCCON.TenDanhMucCon, DIADIEM.TenDiaDiem FROM TINRAOVAT INNER JOIN NGONNGU ON TINRAOVAT.MaNgonNgu = NGONNGU.MaNgonNgu INNER JOIN DANHMUCCON ON TINRAOVAT.MaDanhMucCon = DANHMUCCON.MaDanhMucCon INNER JOIN DIADIEM ON TINRAOVAT.MaDiaDiem = DIADIEM.MaDiaDiem" onupdating="SqlDataSource2_Updating" 
                ></asp:SqlDataSource>
		</div>
	 </div>
    </div>
</asp:Content>